import { initTRPC } from '@trpc/server'
import superjson from 'superjson'
import type { AuthContext } from './context/authContext'

const t = initTRPC.context<AuthContext>().create({
  /**
   * @link https://trpc.io/docs/v11/data-transformers
   */
  transformer: superjson,
  /**
   * @link https://trpc.io/docs/v11/error-formatting
   */
  errorFormatter({ shape }) {
    return shape
  },
})

export const router = t.router
export const publicProcedure = t.procedure
